package edu.rutgers.moko.data.util;

import java.util.Arrays;
import java.util.List;

public enum OMField {
		VERSION("Version", "ver"),
		BRANCH("Branch", "branch"),
		BUILD_HOST("Build host", "host"),
		BATTERY_TECHNOLOGY("Battery technology", "btech"),
		BATTERY_CAPACITY("Battery capacity", "bcap"),
		BATTERY_TTE("Battery time to empty", "btte"),
		BATTERY_STATUS("Battery status", "bstatus"),
		BRIGHTNESS_MAX("Display maximum brightness", "dispmax"),
		BRIGHTNESS_CURR("Display current brightness", "dispcurr"),
		TIMEZONE("Timezone", "tz"),
		BLUETOOTH("Bloetooth", "bt");
		
		private final String title;
		private final String field;
		
		private OMField(String title, String field){
			this.title = title;
			this.field = field;
		}
		
		public String title(){
			return title;
		}
		
		public String field(){
			return field;
		}
		
		public static List<OMField> valuesAsList(){
			List<OMField> result = Arrays.asList(OMField.values());
			return result;
		}
		
		public static OMField getByField(String field) {
		OMField tp = null;

		if (field.toLowerCase().equals("ver")) {
			tp = OMField.VERSION;
		}
		if (field.toLowerCase().equals("branch")) {
			tp = OMField.BRANCH;
		}
		if (field.toLowerCase().equals("host")) {
			tp = OMField.BUILD_HOST;
		}

		if (field.toLowerCase().equals("btech")) {
			tp = OMField.BATTERY_TECHNOLOGY;
		}

		if (field.toLowerCase().equals("bcap")) {
			tp = OMField.BATTERY_CAPACITY;
		}
		if (field.toLowerCase().equals("btte")) {
			tp = OMField.BATTERY_TTE;
		}

		if (field.toLowerCase().equals("bstatus")) {
			tp = OMField.BATTERY_STATUS;
		}

		if (field.toLowerCase().equals("dispmax")) {
			tp = OMField.BRIGHTNESS_MAX;
		}

		if (field.toLowerCase().equals("dispcurr")) {
			tp = OMField.BRIGHTNESS_CURR;
		}

		if (field.toLowerCase().equals("tz")) {
			tp = OMField.TIMEZONE;
		}
		if (field.toLowerCase().equals("bt")) {
			tp = OMField.BLUETOOTH;
		}
		return tp;

	}
}
